<form id="groupEditForm" class="parsley-form" data-parsley-validate role="form" method="post" action="$!basePath/system/group/edit/do">
    <input type="hidden" name="id" value="$!group.id"/>
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">编辑用户组</h4>
    </div>
    <div class="modal-body">
        <div class="row">
            <div class="col-lg-12 col-md-12">
                <div class="form-group">
                    <label class="control-label">名称</label>
                    <input type="text" class="form-control" name="name" value="$!group.name" data-parsley-required="true" placeholder="名称" autofocus>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12 col-md-12">
                <div class="form-group">
                    <label class="control-label">描述</label>
                    <textarea class="form-control" name="descript" placeholder="描述">$!group.descript</textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button id="ok" type="submit" class="btn btn-primary btn-form-submit" data-loading-text="正在保存...">提 交</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
    </div>
</form>
<script type="text/javascript">
    ns.requireJS([
        "/framework/js/form/form.js",
        "/framework/js/form/validator.js"
    ]);
    ns.ready(function (dialog) {
        $("#groupEditForm").ajaxForm({
            beforeSubmit: function (arr, $form , options) {
                $form.find("#ok").button("loading");
            },
            success: function (data, statusText, xhr, $form) {
                if (data.success == true) {
                    ns.tip.toast.success("更新成功！");
                    ns.view.Dialog.close($form, {isEdited: true});
                } else {
                    ns.tip.toast.error(data.message);
                }
                $form.find("#ok").button("reset")
            ;
            }
        });
    });
</script>